package com.fy.fyzf.presenter;

import com.fy.fyzf.api.SubscriberCallBack;
import com.fy.fyzf.base.BasePresenter;
import com.fy.fyzf.bean.LoginBean;
import com.fy.fyzf.bean.BaseData;
import com.fy.fyzf.view.UserLoginView;
import com.google.gson.Gson;
import com.socks.library.KLog;

public class LoginPresenter extends BasePresenter<UserLoginView> {

    public LoginPresenter(UserLoginView view) {
        super(view);
    }

    /**
     * 登录
     */
    public void userLogin(String appIpAddress,String userAccount,String userPwd){
        addSubscription(mApiService.userLogin(appIpAddress, userAccount, userPwd), new SubscriberCallBack<BaseData<LoginBean>>(mView,true) {
            @Override
            protected void onSuccess(BaseData<LoginBean> response) {
                KLog.e("登录"+new Gson().toJson(response));
                mView.userLoginSuccess(response.data);
            }

            @Override
            protected void onError() {
                KLog.e("登录onError");
            }
        });
    }
}
